﻿<local:DocumentBase x:Class="WPFExcelReport.YCAFSPLAN"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core"
                    xmlns:fd="clr-namespace:Labs.Filtering;assembly=ReflectionStudio.Core"
                    xmlns:db="clr-namespace:INTEX.DataBase"
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"
                    xmlns:mx="clr-namespace:DynamicListView.Controls;assembly=MatrixLib"
                    xmlns:wep="clr-namespace:WPFExcelReport"
                    Height="700" Width="1024" 
                    FontSize="16"
                   Background="White"
                    Loaded="Window_Loaded"
     >
    <local:DocumentBase.Resources>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <db:SETINTEXDB  x:Key="SetData" />
        <db:SETINTEXDB  x:Key="SetProd" />
        <CollectionViewSource   x:Key="vwLIEFDAT" Source="{Binding Path=LIEFDAT,Source={StaticResource SetData}}" />
        <CollectionViewSource   x:Key="vwFSSTAMM" Source="{Binding Path=FSSTAMM,Source={StaticResource SetProd}}" />
        <CollectionViewSource   x:Key="vwABKOPF" Source="{Binding Path=ICC_ABKOPF,Source={StaticResource SetData}}" />
        <CollectionViewSource   x:Key="vwABPOS_MAT" Source="{Binding Path=ICC_ABPOS_MAT,Source={StaticResource SetProd}}" />
        <CollectionViewSource   x:Key="vwMDECKMAT" Source="{Binding Path=ICC_MDECKMAT,Source={StaticResource SetProd}}" />
        <CollectionViewSource   x:Key="vwWDECKMAT" Source="{Binding Path=ICC_WDECKMAT,Source={StaticResource SetProd}}" />
        <CollectionViewSource   x:Key="vwFDECKMAT" Source="{Binding Path=ICC_FDECKMAT,Source={StaticResource SetProd}}" />
        <CollectionViewSource   x:Key="vwGAAUFMAT" Source="{Binding Path=ICC_GAAUFMAT,Source={StaticResource SetProd}}" />
    </local:DocumentBase.Resources>
    <Grid   >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*" />
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
            <WrapPanel> 
                    <Button FontSize="18" Content="查询" Height="40" Margin="20,0,0,0" Name="butGetData" Click="btnQuery_Click"></Button>
                    <ComboBox
                    Name="cbWTYE"
                    HorizontalAlignment="Left"
                    IsEditable="True"
                    Background="White"
                    IsTextSearchEnabled="True"
                    IsTextSearchCaseSensitive="False"                           
                    Width="100" 
                    >
                        <ComboBoxItem Content="成衣款式"/>
                        <ComboBoxItem Content="面料"/>
                        <ComboBoxItem Content="辅料"/>
                        <ComboBoxItem Content="高级辅料"/>
                    </ComboBox>
                    <TextBlock FontSize="18"   Width="59"  Margin="0,0,0,0" Text="款式" />
                    <TextBox Background="Yellow"  FontSize="18"    Width="180" Name="txtFSART" CharacterCasing="Upper" Margin="10,0,0,0" Text="" />
                    <ComboBox
                            Name="cbFSSTAMM"
                              HorizontalAlignment="Left"
                              IsEditable="True"
                              IsTextSearchEnabled="True"
                              IsTextSearchCaseSensitive="False"
                              SelectionChanged="cbFSART_SelecteionChanged"
                              Width="200"
                              DisplayMemberPath="FSABEZ"
                              SelectedValuePath="FSART"                     
                              ItemsSource="{Binding Source={StaticResource ResourceKey=vwFSSTAMM}}"
                              >
                    </ComboBox>
                    <Button Content="打印"  FontSize="18" Height="40" Margin="20,0,0,0"  Name="btnPrint" Width="Auto" Click="btnPrint_Click"/>
                </WrapPanel>  
        </StackPanel>
        <DockPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" LastChildFill="True">
            <FlowDocumentScrollViewer  >
                <FlowDocument>
                    <Paragraph> 
                        <WrapPanel>
                            <CheckBox IsChecked="False" Name="IsStartApproval" Background="Yellow" 
                                      VerticalAlignment="Center" Visibility="Hidden">
                                <CheckBox.LayoutTransform>
                                    <ScaleTransform ScaleX="2" ScaleY="2" />
                                </CheckBox.LayoutTransform>
                            </CheckBox> 
                            <Button Name="btnUpdateIntex" Click="btnUpdateIntex_Click" Margin="30,0,0,0" Height="40" Width="40">
                                <Button.Background>
                                    <ImageBrush  ImageSource="Image/Save.png" />
                                </Button.Background>
                            </Button>
                            <TextBlock Margin="30,0,0,0" >保存</TextBlock>
                            <Button Name="btnApprove" Click="btnApprove_Click" Margin="30,0,0,0" Height="40" Width="40">
                                <Button.Background>
                                    <ImageBrush  ImageSource="Image/button_ok.png" />
                                </Button.Background>
                            </Button>
                            <TextBlock Margin="30,0,0,0" >确认</TextBlock>
                            <Button FontSize="18"  Height="40" Width="40" Margin="20,0,0,0" x:Name="btnRefresh"
                                    Click="btnRefresh_Click">
                                <Button.Background>
                                    <ImageBrush  ImageSource="Image/Reload.png" />
                                </Button.Background>
                                <TextBlock Margin="30,0,0,0" >刷新</TextBlock>
                            </Button>
                            <TextBlock>总件数:</TextBlock>
                            <TextBlock Name="txtTotal" Width="100"></TextBlock>
                            <TextBlock>尺码</TextBlock>
                        </WrapPanel>
                    </Paragraph>
                    <Paragraph>
                        <StackPanel>
                            <DataGrid 
                                CanUserReorderColumns="True"  
                                CanUserResizeRows="True" 
                                CanUserSortColumns="True"                  
                                AutoGenerateColumns="False"   
                                EnableRowVirtualization="False"  
                                HorizontalAlignment="Stretch" 
                                VerticalAlignment="Stretch"
                                IsSynchronizedWithCurrentItem="True"
                                CellEditEnding="MasterDataGrid_CellEditEnding"
                                ItemsSource="{Binding Source={StaticResource ResourceKey=vwABPOS_MAT}}"  
                                x:Name="SizeColorMatrixDataGrid" 
                                Margin="0,1,0,0" 
                                IsTextSearchCaseSensitive="True" 
                                RowDetailsVisibilityMode="Visible"
                                SelectionUnit="Cell">
                                <DataGrid.RowDetailsTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal" Margin="50,0,0,0" HorizontalAlignment="Right">
                                            <TextBlock Foreground="Black" FontSize="12" Text="意向量"/>
                                            <TextBlock Foreground="Black" FontSize="12" Text="{Binding Path=TQTYP}"/>
                                            <TextBlock Foreground="Green" Margin="10,0,0,0" FontSize="12" Text="S:"/>
                                            <TextBlock Foreground="Green" Margin="10,0,0,0" FontSize="12" Text="{Binding Path=SP}"/>
                                            <TextBlock Foreground="Red" Margin="10,0,0,0" FontSize="12" Text="M:"/>
                                            <TextBlock Foreground="Red" Margin="10,0,0,0"  FontSize="12" Text="{Binding Path=MP}"/>
                                            <TextBlock Foreground="Green" Margin="10,0,0,0"  FontSize="12" Text="L:"/>
                                            <TextBlock Foreground="Green" Margin="10,0,0,0"  FontSize="12" Text="{Binding Path=LP}"/>
                                            <TextBlock Foreground="Red" Margin="10,0,0,0"  FontSize="12" Text="XL:"/>
                                            <TextBlock Foreground="Red" Margin="10,0,0,0"  FontSize="12" Text="{Binding Path=XLP}"/>
                                        </StackPanel>
                                    </DataTemplate>
                                </DataGrid.RowDetailsTemplate>
                                <DataGrid.Columns>
                                    <DataGridTextColumn Binding="{Binding Path=ABPART}" Header="款式"   Width="180" />
                                    <DataGridTextColumn Binding="{Binding Path=ABPFARBE}" Header="颜色"   Width="60" />
                                    <DataGridTextColumn Binding="{Binding Path=TQTY}" Header="数量"   Width="80" />
                                    <DataGridTextColumn Binding="{Binding Path=S}" Header="S"   Width="60" >
                                    </DataGridTextColumn>
                                    <DataGridTextColumn Binding="{Binding Path=M}" Header="M"  Width="60" />
                                    <DataGridTextColumn Binding="{Binding Path=L}" Header="L"  Width="60" />
                                    <DataGridTextColumn Binding="{Binding Path=XL}" Header="XL"  Width="60" />
                                </DataGrid.Columns>
                            </DataGrid  >
                            <DataGrid CanUserReorderColumns="True"  
                                      CanUserResizeRows="True" CanUserSortColumns="True"                  
                                      AutoGenerateColumns="False"   
                                      EnableRowVirtualization="True"  
                                      RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                      IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                                      ItemsSource="{Binding Source={StaticResource ResourceKey=vwWDECKMAT}}"  x:Name="WDECKDataGrid" 
                                      CellEditEnding="WDECKDataGrid_CellEditEnding"
                                      SelectionUnit="Cell"
                                      Grid.ColumnSpan="4" Margin="0,1,0,0" Grid.Row="2"                   >
                                <DataGrid.Columns>
                                    <DataGridTextColumn Binding="{Binding Path=ART}" Header="面料"   Width="180" />
                                    <DataGridTextColumn Binding="{Binding Path=FARBE}" Header="颜色"   Width="140" />
                                    <DataGridTextColumn Binding="{Binding Path=TQTY, Converter={StaticResource ResourceKey=d100}}" Header="数量"   Width="120" />
                                </DataGrid.Columns>
                            </DataGrid  >
                            <DataGrid CanUserReorderColumns="True"  
                                      CanUserResizeRows="True" CanUserSortColumns="True"                  
                                      AutoGenerateColumns="False"   
                                      EnableRowVirtualization="True"  
                                      RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                      IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                                      ItemsSource="{Binding Source={StaticResource ResourceKey=vwMDECKMAT}}"  x:Name="MDECKDataGrid" 
                                      CellEditEnding="MDECKDataGrid_CellEditEnding"
                                      Grid.ColumnSpan="4" Margin="0,1,0,0" Grid.Row="2" SelectionUnit="Cell">
                                <DataGrid.Columns>
                                    <DataGridTextColumn Binding="{Binding Path=ART}" Header="辅料"   Width="320" />
                                    <DataGridTextColumn Binding="{Binding Path=TQTY, Converter={StaticResource ResourceKey=d100}}" Header="数量"   Width="120" />
                                </DataGrid.Columns>
                            </DataGrid  >
                            <DataGrid CanUserReorderColumns="True"  
                                      CanUserResizeRows="True" CanUserSortColumns="True"                  
                                      AutoGenerateColumns="False"     
                                      EnableRowVirtualization="True"  
                                      RowDetailsVisibilityMode="VisibleWhenSelected" 
                                      HorizontalAlignment="Stretch" 
                                      VerticalAlignment="Stretch"
                                      IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                                      ItemsSource="{Binding Source={StaticResource ResourceKey=vwFDECKMAT}}"  x:Name="GAAUFDataGrid" 
                                      CellEditEnding="FDECKDataGrid_CellEditEnding"
                                      Grid.ColumnSpan="4" Margin="0,1,0,0" Grid.Row="2" SelectionUnit="Cell">
                                <DataGrid.Columns>
                                    <DataGridTextColumn Binding="{Binding Path=ART}" Header="高级辅料"   Width="120" />
                                    <DataGridTextColumn Binding="{Binding Path=FARBE}" Header="颜色"   Width="120" />
                                    <DataGridTextColumn Binding="{Binding Path=SIZE}" Header="尺寸"   Width="80" />
                                    <DataGridTextColumn Binding="{Binding Path=TQTY}" Header="数量"   Width="120" />
                                </DataGrid.Columns>
                            </DataGrid  >
                        </StackPanel>
                    </Paragraph>
                </FlowDocument>
            </FlowDocumentScrollViewer>
        </DockPanel>
    </Grid>
</local:DocumentBase>
